package cn.echoedu.service;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.echoedu.servlet.BaseServlet;
import cn.echoedu.util.L;
import cn.echoedu.util.WebContext;

public class MainService {
	private final String T="MainService---------->";
	private HttpServlet httpservlet;
	private int servletcode;
	private final int BaseServletCode=101;
	private BaseServletService baseservletservice;
	public void init(HttpServlet httpservlet){
	    if(httpservlet instanceof BaseServlet){
		  servletcode=BaseServletCode;
		  baseservletservice=(BaseServletService)WebContext.getServletContext()
				  .getAttribute("BaseServletService");
		  
	  }
	}
	public void doHead(HttpServletRequest request,HttpServletResponse response){

	}
	public void doGet(HttpServletRequest request,HttpServletResponse response) 
			throws IOException, SQLException{
//		service(request,response);
	}
	public void doPost(HttpServletRequest request,HttpServletResponse response)
			throws IOException, SQLException{
//	    service(request,response);
	}
	public void service(HttpServletRequest request,HttpServletResponse response)
			throws IOException, SQLException{
		L.p(T+"service");
		switch (servletcode){
		case BaseServletCode:
			 baseservletservice.service(request, response);
		break;
			default:
				
		}
	}

	
}
